<?
    class CM_Log extends Zend_Log
    {
        public function __construct($file_path)
        {
            $format = "%timestamp% %priorityName% (%priority%): %message% %info%";

            $writer = new Zend_Log_Writer_Stream($file_path);
            $writer->setFormatter(new CM_Formatter_Simple($format));

            parent::__construct($writer);

            $this->registerErrorHandler();
            $this->setTimestampFormat("[ H:i:s d.m.Y ]");
        }


        /**
         * errorHandler
         *
         * Переопределение метода обработки ошибок, длч выброса исключений.
         *
         * @param int $code
         * @param string $message
         * @param string $file
         * @param int $line
         * @param array $context
         * @return bool|void
         * @throws ErrorException
         */
        public function errorHandler($code, $message, $file, $line, $context)
        {
            throw new ErrorException($message, $code, $severity = 1, $file, $line);
        }
    };
?>
